package com.lyl.momanapp.activity;

import android.content.Intent;
import android.view.View;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.LinearLayout;

import com.lyl.momanapp.R;
import com.lyl.momanapp.util.view.MyBaseActivity;

/**
 * 名字 梁亚龙
 * 时间 2017/9/15.
 * QQ邮箱 503934353@qq.com
 * 是否开发票页面
 */

public class UserKaiFaPiaoActivity extends MyBaseActivity {


    private CheckBox mCB_1;
    private CheckBox mCB_2;
    private LinearLayout mLL;
    private Button mBut;

    @Override
    public void initUI() {
    setContentView(R.layout.activity_user_kaifapiao);
        mCB_1 = ((CheckBox) findViewById(R.id.kaifapiao_ck1));
        mCB_2 = ((CheckBox) findViewById(R.id.kaifapiao_ck2));
        mLL = ((LinearLayout) findViewById(R.id.kaifapiao_ll));
        mLL.setVisibility(View.GONE);
        mBut = ((Button) findViewById(R.id.kaifapiao_but));
    }

    @Override
    public void initData() {

    }

    @Override
    public void addListeners() {
        findViewById(R.id.fanhui).setOnClickListener(this);
        findViewById(R.id.zhuye).setOnClickListener(this);
        mBut.setOnClickListener(this);
        mCB_1.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
                        if (b){
                            mCB_2.setChecked(false);
                            mLL.setVisibility(View.VISIBLE);
                        }
            }
        });
        mCB_2.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
                if (b){
                    mCB_1.setChecked(false);
                    mLL.setVisibility(View.GONE);
                }
            }
        });
    }
    @Override
    public void onClick(View view) {
            switch (view.getId()){
                case R.id.kaifapiao_but:{
                    finish();

                }break;
                case R.id.fanhui:{
                    finish();
                }
                break;
                case R.id.zhuye: {

                    startActivity(new Intent(UserKaiFaPiaoActivity.this, MainActivity.class));
                    finish();
                }
            }
    }
}
